public class ThreadDemo08 {
    public static void main(String[] args) {
        // 创建Thread对象，把实现runnable通过构造方法传递进去
        Thread thread = new Thread(new MyThread1());
        thread.start();

        Thread thread1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 1000; i++) {
                    System.out.println(i);
                }
            }
        });
        thread1.start();
    }
}


class MyThread1 implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(i);
        }
    }
}